package shared.other;

public class UserRolesDefinition {
	
	public static final String ADMIN_ROLE_KEY = "ADMIN";
	public static final String EMPLOYEE_ROLE_KEY = "EMPLOYEE";
	public static final String FOREMAN_ROLE_KEY = "FOREMAN";
	
	public static UserRole get(String key) {
		for (UserRole role : UserRole.values()) {
			if (role.getKey().equals(key)) {
				return role;
			}
		}
		return null;
	}
	
	public static enum UserRole {
		
		ADMIN(ADMIN_ROLE_KEY, "roles.admin.name", "roles.admin.description"),
		EMPLOYEE(EMPLOYEE_ROLE_KEY, "roles.employee.name", "roles.employee.description"),
		FOREMAN(FOREMAN_ROLE_KEY, "roles.foreman.name", "roles.foreman.description"),
		;
		
		private String key;
		private String name;
		private String description;
		
		
		
		private UserRole(String roleKey, String name, String description) {
			this.setKey(roleKey);
			this.name = name;
			this.description = description;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public String getKey() {
			return key;
		}

		public void setKey(String key) {
			this.key = key;
		}
	}
}
